package com.qk.management.mapper;

import com.qk.entity.Activity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 *
 * @author lyl
 * @created 2025/10/9 9:05
 * @description
 *
 */
@Mapper
public interface ActivityMapper {
    List<Activity> getListByPage(@Param("channel") Integer channel,@Param("type") Integer type,@Param("status") Integer status);


    void add(Activity activity);

    @Delete("delete from activity where id=#{id}")
    void delete(Integer id);

    @Select("select id, channel, name, start_time, end_time, description, type, discount, voucher, create_time, update_time from activity where id=#{id}")
    Activity getActivityById(Integer id);

    @Update("update activity set channel=#{channel},name=#{name},start_time=#{startTime},end_time=#{endTime},description=#{description},type=#{type},discount=#{discount},voucher=#{voucher},update_time=#{updateTime} where id=#{id}")
    void update(Activity activity);

    @Select("select id, channel, name, start_time, end_time, description, type, discount, voucher, create_time, update_time from activity where type=#{type}")
    List<Activity> getListByType(Integer type);
}
